Skip to content

feat: add stats/incr/nanprod#6026

Merged
Planeshifter merged 18 commits into
stdlib-js:developfrom
jalajk3004:nanprod
Jul 7, 2026
Merged

feat: add stats/incr/nanprod#6026
Planeshifter merged 18 commits into
stdlib-js:developfrom
jalajk3004:nanprod

Conversation

@jalajk3004

Copy link
Copy Markdown
Contributor

Resolves #5619

Description

What is the purpose of this pull request?

This pull request:

  • adds a package nanprod, which works like prod in which it calculates prod incrementally ignoring NaN values

image
image
image

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Mar 13, 2025
@stdlib-bot

stdlib-bot commented Mar 13, 2025

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/incr/nanprod $\\color{green}128/128$
$\\color{green}+0.00\\%$
$\\color{green}7/7$
$\\color{green}+0.00\\%$
$\\color{green}2/2$
$\\color{green}+0.00\\%$
$\\color{green}128/128$
$\\color{green}+0.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte kgryte self-requested a review April 30, 2025 02:26
@kgryte kgryte added the Feature Issue or pull request for adding a new feature. label Apr 30, 2025
@kgryte

kgryte commented Apr 30, 2025

Copy link
Copy Markdown
Member

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Apr 30, 2025
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Apr 30, 2025
*
* ## Notes
*
* - If provided `NaN` or a value which, when used in computations, results in `NaN`, the accumulated value is `NaN` for all future invocations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note was copied from prod but is incorrect for nanprod. The whole purpose of this package is to ignore NaN values, not propagate them. The tests at lines 220-222 and 246-248 explicitly verify this behavior (e.g., 'ignores NaN and retains +infinity').

Suggested change
* - If provided `NaN` or a value which, when used in computations, results in `NaN`, the accumulated value is `NaN` for all future invocations.
* - If provided `NaN`, the value is ignored and the accumulated product remains unchanged.

@Planeshifter Planeshifter added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Jan 16, 2026
@Planeshifter Planeshifter requested a review from a team July 7, 2026 04:49
@Planeshifter Planeshifter dismissed their stale review July 7, 2026 04:50

Requested changes applied in the maintainer cleanup commit: removed the incorrect NaN note in index.d.ts and added the missing '// MAIN //' section header. Dismissing the stale review.

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jul 7, 2026
- Add the missing '// MAIN //' section header (lint requires it) and drop the Method/References JSDoc blocks copied from incr/prod, since this package delegates
- Remove the incorrect NaN-propagation note from index.d.ts (it ignores NaN)
- Drop backticks from package.json description and tidy README wording
- Fix examples output to use %s and guard against a null accumulated value
- Bump copyright year to 2026

@Planeshifter Planeshifter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Planeshifter Planeshifter added the Ready To Merge A pull request which is ready to be merged. label Jul 7, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

PR Commit Message

feat: add `stats/incr/nanprod`

PR-URL: https://github.com/stdlib-js/stdlib/pull/6026
Closes: https://github.com/stdlib-js/stdlib/issues/5619

Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com>
Co-authored-by: stdlib-bot <noreply@stdlib.io>
Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>

Please review the above commit message and make any necessary adjustments.

@stdlib-bot stdlib-bot removed Needs Review A pull request which needs code review. Needs Changes Pull request which needs changes before being merged. labels Jul 7, 2026
@Planeshifter Planeshifter merged commit 64a6581 into stdlib-js:develop Jul 7, 2026
32 checks passed
@stdlib-bot stdlib-bot removed the Ready To Merge A pull request which is ready to be merged. label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue or pull request for adding a new feature. Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add stats/incr/nanprod

4 participants